<template>
    <div>
        <h1>会员登录</h1>
        <table>
            <thead>
                <tr>
                    <td>用户名</td>
                    <td>
                        <input type="text" v-model="data.usename" >
                    </td>
                    
                </tr>
                <tr>
                    <td>密码</td>
                    <td>
                        <input type="password" v-model="data.usemima"  >
                    </td>
                    
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input type="button" value="登录" @click="Deng()" >
                    </td>
                    
                </tr>
            </thead>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import axios from 'axios';
import { useRoute } from 'vue-router';
const data=ref({
    usename:'',
    usemima:'',
})


const Deng=()=>{axios.get("https://localhost:7146/api/Basa/Denglu",
{params:data.value}).then(res=>{
    if(res.data.usename=="")
    {
        alert("用户名不能为空");
        return;
    }
    if(res.data.usemima=="")
    {
        alert("密码不能为空");
        return;
    }
    if(res.data.DId==-1)
    {

        alert("用户不存在");
        return;
    }
    if(res.data.DId==-2)
    {
        alert("密码错误");
        return;
    }
    if(res.data.DId>0)
    {
        alert("登录成功")
        location.href="/Liset"
    }
    else
    {
        alert("服务器繁忙，请稍后再试");
    }
}
)}


</script>

<style scoped>

</style>